<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored ="false"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>北京市电子行政监察平台-编辑数据源</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="<%=path%>/css/base.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/frame.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			var path = "<%=path%>";
		</script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery-1.6.1.min.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery.metadata.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery.validate.fixed.pack.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/init.js"></script>
		<script type="text/javascript">
		$(function () {
				$("#connTestBtn").click(function () {
						var $this = $(this);
						$this.attr("disabled", "disabled");
						$this.html("测试中..");
						$.post("<%=path%>/ajax/checkDataSourceInfoAction.action",{
                            "dataSourceInfoDto.dialect": $("#dialect").val(),
							"dataSourceInfoDto.driverClass": $("#driverClass").val(),
							"dataSourceInfoDto.url": $("#url").val(),
							"dataSourceInfoDto.username": $("#username").val(),
							"dataSourceInfoDto.password": $("#password").val()
					         },
							function(data){
                               if(data.isSuccess){
                            	   alert("测试成功");
                               }else{
                            	   alert("测试失败");
                               }
                 
						    });
						$this.html("连接测试");
						$this.removeAttr("disabled");
						return false;
					});
			});
		</script>
		<style type="text/css">
			div {
				position: static;
			}
		</style>
	</head>
	<body>
		<div id="mainPage" class="surround-layout">
			<jsp:include page="/jsp/frame/top.jsp" flush="true"></jsp:include>
			<div class="middle">
				<!-- 右侧输出内容 -->
				<div class="right">
					<div class="right-all-content">
						<div>
							<div class="content-line-wrap">
								<div class="content-line-left content-line">
									<h1 class="content-title">
										<span>
											<a href="<%=path %>/web/toDataSourceInfoPageAction.action">数据源管理</a>
										</span>
										<span>
										</span>
									</h1>
								</div>
							</div>
							<div class="inner-dialog">
								<h1 class="inner-dialog-title">编辑数据源</h1>
								<div class="inner-dialog-content">
								<!-- 填入action地址 -->
								<form method="post" action="<%=path%>/web/editDataSourceInfoAction.action" name="creatorForm" id="creatorForm" class="normal-form use-def-validate">
									<table>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>数据源名称:</span>
												<input type="text" name="dataSourceinfoDto.name" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}" value="${dataSourceinfoDto.name}"/>
												<input type="hidden" name="dataSourceinfoDto.dataSourceInfoId" value="${dataSourceinfoDto.dataSourceInfoId}"/>
									            <input type="hidden" name="dataSourceinfoDto.version" value="${dataSourceinfoDto.version}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>DIALECT:</span>
												<input type="text" id ="dialect" name="dataSourceinfoDto.dialect" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}" value="${dataSourceinfoDto.dialect}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>DRIVECLASS:</span>
												<input type="text" id="driverClass" name="dataSourceinfoDto.driverClass" value="${dataSourceinfoDto.driverClass}" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>URL:</span>
												<input type="text" id ="url" name="dataSourceinfoDto.url" value="${dataSourceinfoDto.url}" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>用户名:</span>
												<input type="text" id ="username" name="dataSourceinfoDto.username" value="${dataSourceinfoDto.username}" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>密码:</span>
												<input type="password" id="password" name="dataSourceinfoDto.password" value="${dataSourceinfoDto.password}" class="shadow nf-double-cell {required: true, messages: {required: '必填'}}"/>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<button class="special examine-circuit" id="connTestBtn" style="color: #336600;">连接测试</button>
											</td>
										</tr>
										<tr>
											<td colspan="2" valign="top">
												<span class="form-field"><span class="important-field-star">*</span>描述:</span>
												<textarea name="dataSourceinfoDto.note"  class="shadow nf-double-cell {maxlength: 64, messages: {maxlength: '长度不能超过256个字符'}}" >${dataSourceinfoDto.note}</textarea>
											</td>
										</tr>
										<tr>
											<td valign="top">
												<input type="submit" value="保存" class="special originate"/>
											</td>
										</tr> 
									</table>
								</form>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--  -->
			</div>
		</div>
	</body>
</html>